package P1_2;

public class T05 {
    public static void main(String[] args) {
        CookVegetable cv=new CookCabage();
        cv.炒菜();
    }
}
abstract class CookVegetable{

    public void 炒菜() {
        起锅爆香();
        放入蔬菜();
        加入调料();
        装盘();
    }

    protected abstract void 起锅爆香();
    protected abstract void 放入蔬菜();
    protected abstract void 加入调料();


    private void 装盘() {
        System.out.println("将炒好的菜肴装盘送给客户");
    }

}
class CookTomato extends CookVegetable{

    @Override
    protected void 起锅爆香() {
        System.out.println("加油");
        System.out.println("放入蒜粒");
    }

    @Override
    protected void 放入蔬菜() {
        System.out.println("倒进切好的西红柿块翻炒");
        System.out.println("加入预先炒好的鸡蛋");

    }

    @Override
    protected void 加入调料() {
        System.out.println("放入少许鸡精");
    }
    public void 炒菜(){
        System.out.println("哈哈哈，我要炒西红柿啦");
        super.炒菜();
    }
}
class CookCabage extends CookVegetable{

    @Override
    protected void 起锅爆香() {
        System.out.println("油烧热");
        System.out.println("放入辣椒和花椒炒香");
    }

    @Override
    protected void 放入蔬菜() {
        System.out.println("加入手撕卷心菜");
        System.out.println("翻炒至熟");
    }

    @Override
    protected void 加入调料() {
        System.out.println("出锅前加入少许蒜粒");
    }
}